<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<!-- End of Flash Script -->
<?php 

session_start();
if($_SESSION['status'] == " ")
{
$_SESSION['status']=NULL;
}
?>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Customer Support</title>
<link href="../CSS/Divlayouts.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv1 {
	position:absolute;
	width:838px;
	height:115px;
	z-index:6;
	left: 117px;
	top: 15px;
}
#apDiv2 {
	position:absolute;
	width:200px;
	height:34px;
	z-index:6;
	left: 331px;
	top: 41px;
}
#apDiv3 {
	position:absolute;
	width:107px;
	height:32px;
	z-index:6;
	left: -113px;
	top: 41px;
}
#apDiv4 {
	position:absolute;
	width:220px;
	height:31px;
	z-index:7;
	left: 203px;
	top: 42px;
}
#apDiv5 {
	position:absolute;
	width:109px;
	height:25px;
	z-index:1;
	left: 31px;
	top: -9px;
}
#apDiv6 {
	position:absolute;
	width:108px;
	height:28px;
	z-index:6;
	left: 1079px;
	top: 100px;
}
#apDiv7 {
	position:absolute;
	width:582px;
	height:379px;
	z-index:3;
	left: 406px;
	top: 175px;
}
</style>
</head>


	
<body>
<pre><p>                          <a href="index.php" ><img src="../Resources/eMart logo.png" width="170" height="67" alt="Logo" /></a>                                                                <b><a  style="color:#000; text-decoration:none;" href="customer_support.php">Customer Support</a>  |  <a style="color:#000; text-decoration:none;" href="Terms.php">Privacy Policy</a></b>
                                          <?php if (($_SESSION['status']== NULL)||($_SESSION['status']== "OUT")){echo"Welcome! <a href='login.php'>Sign in</a> or <a href='Register.php'>Register</a>";} else { echo "Welcome ".($_SESSION['fname'])." ".($_SESSION['lname']) ."<pre>                                  <a  class='underline' href='refresh.php'>Logout</a>    <a class='underline' href='editaccount.php' >My Account</a> </pre>" ; } ?></p></pre>
<div id="apDiv7">

<form action="Contact.php" method="post">
<table>
	<tr>
    	<td>
        	Name:
      </td>
       <td>
        	<input type="text" name="name" value="enter full name" />
       </td>
    </tr>
     <tr>
    	<td>
        	email:
        </td>
        <td>
        	<input type="email" name="email" />
        </td>
    </tr>
     <tr>
    	<td>
        	Subject:
        </td>
        <td>
        	<input type="text" name="subject" />
        </td>
    </tr>
    <tr>
    	<td>Description:
        </td>
        <td>
          	<textarea rows='10' cols = '50' name="decription"> Briefly Describe your query/ needs</textarea>
      </td>  
    </tr>        
</table>
<input type="submit" name="submit" value="Submit" />
</form>
<?php

if(isset($_POST['submit']))
{
	$email="emartsupport@emart.com";
	$subject= $_POST['subject'];
	$from= $_POST['email'];
	if(!$email| !$subject | $body)
	{
		die("Please Fill in all Fields");
	}
	else
	{
		if(preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["name"]) === 0)
		{
			die("Name format incorrent");	
		}
		else
		{
			$body= $_POST['name'].$_POST['phone'].$_POST['decription'];
			$headers = 'From: '.$from."\r\n".
			'Reply-To: '.$from."\r\n" .'X-Mailer: PHP/' . phpversion();
			@mail($email, $subject, $body, $headers);  
		}
	}
}
else
{
	die("Error Submitting Form");
}

?>

</div>
<div id="DivHR"><hr/></div>
<div id="Contact"> 
</div>

</body>

</html>